package com.dhecp.project.logstics.service.impl;

import com.alibaba.fastjson.JSON;
import com.dhecp.common.core.domain.AjaxResult;
import com.dhecp.common.utils.MessageUtils;
import com.dhecp.common.utils.RandomValueUtils;
import com.dhecp.core.constant.DataFiltering;
import com.dhecp.core.utils.PageUtils;
import com.dhecp.framework.util.ShiroUtils;
import com.dhecp.project.common.service.UpdateLogService;
import com.dhecp.project.common.service.impl.BaseModuleServiceImpl;
import com.dhecp.project.finance.domain.AccountCountForCompany;
import com.dhecp.project.finance.domain.AccountDetailedForCompany;
import com.dhecp.project.finance.mapper.AccountCountForCompanyMapper;
import com.dhecp.project.finance.mapper.AccountDetailedForCompanyMapper;
import com.dhecp.project.hr.domain.OperateCompanyApply;
import com.dhecp.project.hr.mapper.OperateCompanyApplyMapper;
import com.dhecp.project.logstics.domain.FbaDevanning;
import com.dhecp.project.logstics.domain.FbaDevanningDetail;
import com.dhecp.project.logstics.domain.FbaWarehousing;
import com.dhecp.project.logstics.mapper.FbaDevanningDetailMapper;
import com.dhecp.project.logstics.mapper.FbaDevanningMapper;
import com.dhecp.project.logstics.mapper.FbaWarehousingMapper;
import com.dhecp.project.logstics.service.FbaDevanningService;
import com.dhecp.project.logstics.service.FbaWarehousingService;
import com.dhecp.project.storage.domain.StockControl;
import com.dhecp.project.storage.domain.StockControlRunning;
import com.dhecp.project.storage.mapper.StockControlMapper;
import com.dhecp.project.storage.mapper.StockControlRunningMapper;
import com.dhecp.project.system.domain.SysAccountBandDept;
import com.dhecp.project.system.mapper.SysAccountBandDeptMapper;
import com.dhecp.project.system.service.SysDictionaryForFieldService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;

import java.util.*;

/**
 * fba入仓单 服务层
 * @Author fxz
 * @Date 2023/12/21
 */
@Service
public class FbaWarehousingServicelmpl extends BaseModuleServiceImpl implements FbaWarehousingService {

    @Autowired
    private FbaWarehousingMapper fbaWarehousingMapper;

    @Autowired
    private SysDictionaryForFieldService dictionaryForFieldService;





    /**
     * fba入仓单列表
     * @param params
     * @return
     * @throws Exception
     */
    @Override
    public List<FbaWarehousing> queryList(Map<String, Object> params) throws Exception {
        params.put(DataFiltering.TABLE_ALIAS, "t1");	//查询表别名
        params.put(DataFiltering.DATA_WHERE, dictionaryForFieldService.getWhereStr(params));	//常规查询条件SQL语句
        params.put(DataFiltering.DATA_SCODE, dictionaryForFieldService.getDataScode(params));	//数据权限查询条件SQL语句

        if (params.get("field") == null || params.get("field") == ""){
            String orderBy = "createTime DESC";
            PageUtils.startPageOrder(orderBy);
        }else{
            PageUtils.startPage();
        }

        return fbaWarehousingMapper.select(params);
    }

    @Override
    public FbaWarehousing queryFirstRecord(Map<String, Object> params) throws Exception {
        params.put(DataFiltering.TABLE_ALIAS, "t1");	//查询表别名
        params.put(DataFiltering.DATA_SCODE, dictionaryForFieldService.getDataScode(params));	//数据权限查询条件SQL语句
        return fbaWarehousingMapper.queryByCodeBox(params);
    }
}
